/**
 * @file drv_spi.h
 * @brief 
 * 
 * @author dalin (dalin@open-robot.com)
 * @version 1.0
 * @date 2023-05-11
 * 
 * @copyright Copyright (c) 2023  Open Robot Tech.co, Ltd
 * 
 * @par 修改日志:
 * <table>
 * <tr><th>Date       <th>Version <th>Author  <th>Description
 * <tr><td>2023-05-11 <td>1.0     <td>dalin     <td>内容
 * </table>
 */

#ifndef _DRV_SPI_H_
#define _DRV_SPI_H_

#include "drv_config.h"

#ifdef USE_SPI_DRIVER
#include "drv_gpio.h"
#include "spi.h"

typedef enum SPINUMBER_
{
    DRV_SPI_INIT = 0,
    DRV_SPI1,
    DRV_SPI2,
    DRV_SPI3,
    DRV_SPI_NUMBER_MAX
}spiNumber_e;


typedef enum SPIMODE_
{

}spiMode_e;


typedef struct DRV_SPI_
{
    spiNumber_e     hspi;
    gpioDrv_t       hw_cs;
}spiDrv_t;




/********************************** drv spi api **********************************/
int drv_spi_send(spiDrv_t drv, uint8_t * data, uint16_t len, uint32_t timeout);
int drv_spi_read(spiDrv_t drv, uint8_t * data, uint16_t len, uint32_t timeout);
int drv_spi_transfer(struct drv_spi, uint8_t * tx_data, uint8_t * rx_data, uint16_t len, uint32_t timeout);

#endif /* USE_SPI_DRIVER */
#endif  /* _DRV_SPI_H_ */

